package com.zbl.zblproject.erp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbl.zblproject.erp.entity.ErpRemoteOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2019/1/18
 */

@Repository
public interface ErpRemoteOrderMapper extends BaseMapper<ErpRemoteOrder> {

    @Select("SELECT DISTINCT remote_order FROM zbl_erp_remote_order WHERE status = 1 ")
    List<String> selectRemoteOrder();

    @Update("UPDATE zbl_erp_remote_order SET status = 1 WHERE local_order = #{orderSn}")
    boolean updateOrderToSuccess(@Param("orderSn") String orderSn);

    @Select("SELECT * FROM zbl_erp_remote_order WHERE local_order = #{orderSn}")
    ErpRemoteOrder selectOneByOrderSn(@Param("orderSn") String orderSn);

}
